home *** CD-ROM | disk | FTP | other *** search
- <script language="VBScript">
-
- function correctLink(a)
- correctLink = a
- if InStr(1, a, "http://siams.com/ww.pl", 1) = 1 then exit function
- if InStr(1, a, "http://siams.com/wwl.pl", 1) = 1 then exit function
- if InStr(1, a, "http://siams.com:", 1) = 1 then
- if InStr(1, a, "/ww.pl", 1) <> 0 then exit function
- if InStr(1, a, "/wwl.pl", 1) <> 0 then exit function
- end if
- correctLink = "http://siams.com/ww.pl?~GZ/" & Right(a, Len(a)-7)
- end function
-
- function openLink(srcAnchor)
- if not (TypeName(srcAnchor) = "HTMLAnchorElement" or TypeName(srcAnchor) = "HTMLAreaElement") then
- openLink = False
- exit function
- end if
- openLink = True
- set l = srcAnchor
- a = "" & l.href
- if Left(a, 1) = "/" then
- a = "http://" & external.menuArguments.document.location.host & a
- end if
- if InStr(a, "http://") = 1 then
- window.open correctLink(a), "_blank"
- else
- alert "Sorry, WebWarper is not applicable for this page. " & Chr(13) _
- & "It is viewed through the """ & l.protocol _
- & """ protocol," & Chr(13) & "but WebWarper can be used only with " _
- & "pages viewed" & Chr(13) & "through the ""http://"" protocol."
- end if
- end function
-
- sub openImg(src)
- a = "" & src
- if Left(a, 1) = "/" then
- a = "http://" & external.menuArguments.document.location.host & a
- end if
- if InStr(a, "http://") = 1 then
- window.open correctLink(a), "_blank"
- else
- alert "Sorry, WebWarper is not applicable for this page. " & Chr(13) _
- & "It is viewed through the """ & Left(a, InStr(a, ":")) _
- & """ protocol," & Chr(13) & "but WebWarper can be used only with " _
- & "pages viewed" & Chr(13) & "through the ""http://"" protocol."
- end if
- end sub
-
- sub OnContextMenu()
- set srcEvent = external.menuArguments.event
- set EventElement = srcEvent.srcElement
- if TypeName(EventElement) = "Nothing" then
- set EventElement = external.menuArguments.document.elementFromPoint(srcEvent.clientX, srcEvent.clientY)
- end if
-
- if srcEvent.type = "MenuExtAnchor" then
- set srcAnchor = EventElement
- do until TypeName(srcAnchor) = "HTMLAnchorElement"
- set srcAnchor = srcAnchor.parentElement
- Loop
- openLink(srcAnchor)
- exit sub
- end if
-
- if srcEvent.type = "MenuExtImage" then
- if TypeName(EventElement) = "HTMLAreaElement" then
- openLink(EventElement)
- else
- set srcImage = EventElement
- set srcAnchor = srcImage.parentElement
- do until TypeName(srcAnchor) = "HTMLAnchorElement"
- set srcAnchor = srcAnchor.parentElement
- if TypeName(srcAnchor) = "Nothing" then
- openLink(srcImage)
- exit sub
- end if
- Loop
- openLink(srcAnchor)
- end if
- exit sub
- end if
-
- if srcEvent.type = "MenuExtUnknown" then
- set srcAnchor = EventElement
- do until TypeName(srcAnchor) = "Nothing"
- if openLink(srcAnchor) then exit sub
- set srcAnchor = srcAnchor.parentElement
- Loop
- if TypeName(EventElement) = "HTMLImg" then
- openImg EventElement.src
- exit sub
- end if
- end if
- end sub
-
- OnContextMenu()
-
- </script>
-